// pages/navigation/new/schedule/detail/detail.js
Page({

  data: {

  },

  onLoad: function (options) {
    var id = options.id;
    wx.cloud.database().collection('schedule_info')
      .doc(id)
      .get()
      .then(res => {
        console.log('请求单条日程成功', res);
        var _agenda = res.data;
        _agenda.time = this.getDateAndTime(_agenda.time)
        this.setData({
          agenda: _agenda
        })
      })
      .catch(err => {
        console.log('请求单条日程失败', err);
      })
  },
  getDateAndTime:function(date) {
    var M = date.getMonth() + 1;
    M = M < 10 ? '0' + M : M;
    var D = date.getDate();
    D = D < 10 ? '0' + D : D;
    var hour = date.getHours();
    hour = hour < 10? '0' + hour : hour;
    var minute = date.getMinutes();
    minute = minute < 10? '0' + minute : minute;
    return M + '月' + D + '日' + ' ' + hour + ':' + minute; 
  }
})